package leetcode.code1796;

import leetcode.IDebug;

public class Solution implements IDebug {

	public int secondHighest(String s) {
		boolean[] exist = new boolean[10];
		char[] cs = s.toCharArray();

		for (char element : cs) {
			char cur = element;
			if (cur >= '0' && cur <= '9') {
				exist[cur - '0'] = true;
			}
		}
		int cnt = 0;
		for (int i = 9; i >= 0; i--) {
			if (exist[i]) {
				cnt++;
			}
			if (cnt == 2) {
				return i;
			}
		}
		return -1;
	}

	@Override
	public void debug4() {
		// TODO Auto-generated method stub

	}

	@Override
	public void debug3() {
		// TODO Auto-generated method stub

	}

	@Override
	public void debug2() {
		// TODO Auto-generated method stub

	}

	@Override
	public void debug1() {
		// TODO Auto-generated method stub

	}

	public static void main(String[] args) {
		// TODO Auto-generated method stub

	}

}
